package com.ldzy.controller;

public class MyResponse {
    private int code;
    private String msg;
    private Object data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    //返回默认消息,默认消息就是成功消息
    public MyResponse(Object data) {
        this.code=ResultCode.SUCCESS.getCode();
        this.msg=ResultCode.SUCCESS.getMsg();
        this.data = data;
    }
//返回携带代码,msg,数据的消息
    public MyResponse(StatusCode statusCode,Object data) {
        this.code=statusCode.getCode();
        this.msg=statusCode.getMsg();
        this.data = data;
    }
//返回不携带数据的消息
    public MyResponse(StatusCode statusCode) {
        this.code=statusCode.getCode();
        this.msg=statusCode.getMsg();
        this.data = null;
    }


}
